/**
 * 
 */
package niuke;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 庆祝61 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int h[]=new int[n];
		for (int i = 0; i < n; i++) {
			h[i]=scanner.nextInt();
		}
		
		Arrays.sort(h);
		int max=0;
		for (int i = 0; i < h.length-2; i++) {
			max=Math.max(h[i+2]- h[i],max);
		}
		max=Math.max(max, h[1]-h[0]);
		max=Math.max(max, h[n-1]-h[n-2]);
		System.out.println(max);
	}

}
